<template>
	<view class="setting2">
		<view class="settingMain">
			<view class="settingMain1">
				<view class="account">
					账号：
					<view class="accountData">{{ items.account }}</view>
				</view>
				<view class="role">
					权限：
					<view class="roleData">{{ items.role }}</view>
				</view>
				<view class="account" @click="toUpdatePassword">
					密码修改
					<view class="Arrow">
						<img src="@/static/右箭头2.png" alt="" />
					</view>
				</view>
				<view class="exit">
					<button @click="exitButton">退出登录</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import { request } from '../../request';

export default {
	data() {
		return {
			items: {
				account: 2943405106,
				role: '管理员'
			}
		};
	},
	methods: {
		toUpdatePassword() {
			uni.navigateTo({
				url: '/pages/inStorage/updatePassword'
			});
		},
		exitButton() {
			uni.showModal({
				title: '退出确认',
				content: '是否确认退出？',
				success: function (res) {
					if (res.confirm) {
						uni.setStorageSync('token', null);
						uni.setStorageSync('role', null);
						request('login/logout', {}, 'POST').then((res) => {
							console.log(res.data.data);
						});
					}
				}
			});
		}
	}
};
</script>

<style scoped>
/* 基础容器样式 - 更柔和的背景 */
.setting2 {
	background-color: #f8fafc;
	min-height: 100vh;
	padding: 20px 16px;
	box-sizing: border-box;
}

/* 主卡片容器 - 更精致的阴影和边框 */
.settingMain {
	background-color: #ffffff;
	border-radius: 16px;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
	padding: 0;
	width: 100%;
	max-width: 450px;
	margin: 0 auto;
	overflow: hidden;
	border: 1px solid #f1f5f9;
}

/* 内容区域调整 */
.settingMain1 {
	padding: 24px;
}

/* 列表项统一样式 */
.account,
.role {
	display: flex;
	align-items: center;
	padding: 16px 0;
	border-bottom: 1px solid #f1f5f9;
	position: relative;
}

/* 图标样式优化 */
.account::before,
.role::before {
	width: 20px;
	height: 20px;
	margin-right: 12px;
	opacity: 0.9;
}

/* 数据展示样式 - 更现代 */
.accountData,
.roleData {
	margin-left: auto;
	color: #334155;
	font-weight: 500;
	padding: 6px 12px;
	background-color: transparent;
	border-radius: 6px;
	text-align: right;
	font-size: 15px;
}

.roleData {
	color: #3b82f6;
}

/* 密码修改项特殊样式 */
.account:last-of-type {
	border-bottom: none;
	color: #64748b;
	font-weight: 500;
	margin-bottom: 0;
	transition: all 0.2s ease;
}

.account:last-of-type:hover {
	color: #3b82f6;
	background-color: #f8fafc;
	border-radius: 8px;
	padding-left: 12px;
	margin-left: -12px;
	margin-right: -12px;
	width: calc(100% + 24px);
}

/* 箭头图标优化 */
.Arrow img {
	position: absolute;
	width: 16px;
	height: 16px;
	transform: none;
	margin: 6px 0 0 150px;
	position: static;
	opacity: 0.6;
}

/* 退出按钮 - 更精致的样式 */
.exit {
	margin-top: 32px;
}

button {
	background-color: #ef4444;
	color: white;
	border: none;
	padding: 12px 0;
	border-radius: 8px;
	font-size: 15px;
	font-weight: 500;
	transition: all 0.2s ease;
	display: block;
}

button:active {
	background-color: #dc2626;
	transform: scale(0.98);
}

/* 响应式调整 */
@media (min-width: 375px) {
	.settingMain1 {
		padding: 28px;
	}

	.account,
	.role {
		padding: 18px 0;
	}
}

/* 微交互增强 */
.account:active,
.role:active {
	background-color: #f8fafc;
}
</style>
